home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 05 - 1989 / 05.12 Dec 89 / MacTutor App Code / MacTutorApp.r < prev    next >
Encoding:
Text File  |  1989-10-18  |  5.3 KB  |  266 lines  |  [TEXT/MPS ]

  1. #include "SysTypes.r"
  2. #include "Types.r"
  3.  
  4. #define kPrefSize                60
  5. #define kMinSize                48
  6.     
  7. #define    kMinHeap                (34 * 1024)
  8. #define    kMinSpace                (20 * 1024)
  9.  
  10. /* id of our STR# for specific error strings */
  11. #define kMacTutorAppErrStrings     129
  12.  
  13. /* Indices into STR# resources. */
  14. #define    eNoMemory                1
  15. #define    eNoWindow                2
  16.  
  17. #define    rMenuBar    128                /* application's menu bar */
  18. #define    rAboutAlert    128                /* about alert */
  19. #define    rDocWindow    128                /* application's window */
  20.  
  21. #define    mApple                    128        /* Apple menu */
  22. #define    iAbout                    1
  23.  
  24. #define    mFile                    129        /* File menu */
  25. #define    iNew                    1
  26. #define    iClose                    4
  27. #define    iQuit                    12
  28.  
  29. #define    mEdit                    130        /* Edit menu */
  30. #define    iUndo                    1
  31. #define    iCut                    3
  32. #define    iCopy                    4
  33. #define    iPaste                    5
  34. #define    iClear                    6
  35.  
  36. #define    myMenu                    131        /* Sample menu */
  37. #define    item1                    1
  38. #define    item2                    2
  39. #define    item3                    3
  40. #define    item5                    5
  41.  
  42. resource 'vers' (1) {
  43.     0x01, 0x00, release, 0x00,
  44.     verUS,
  45.     "1.00",
  46.     "1.00, Copyright © 1989 J. Langowski / MacTutor"
  47. };
  48.  
  49. resource 'MBAR' (rMenuBar, preload) {
  50.     { mApple, mFile, mEdit, myMenu };        /* four menus */
  51. };
  52.  
  53.  
  54. resource 'MENU' (mApple, preload) {
  55.     mApple, textMenuProc,
  56.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  57.     enabled, apple,
  58.     {
  59.         "About CPlusMacTutorApp…",
  60.             noicon, nokey, nomark, plain;
  61.         "-",
  62.             noicon, nokey, nomark, plain
  63.     }
  64. };
  65.  
  66. resource 'MENU' (mFile, preload) {
  67.     mFile, textMenuProc,
  68.     0b0000000000000000000100000000000,    /* program enables others */
  69.     enabled, "File",
  70.     {
  71.         "New",
  72.             noicon, "N", nomark, plain;
  73.         "Open",
  74.             noicon, "O", nomark, plain;
  75.         "-",
  76.             noicon, nokey, nomark, plain;
  77.         "Close",
  78.             noicon, "W", nomark, plain;
  79.         "Save",
  80.             noicon, "S", nomark, plain;
  81.         "Save As…",
  82.             noicon, nokey, nomark, plain;
  83.         "Revert",
  84.             noicon, nokey, nomark, plain;
  85.         "-",
  86.             noicon, nokey, nomark, plain;
  87.         "Page Setup…",
  88.             noicon, nokey, nomark, plain;
  89.         "Print…",
  90.             noicon, nokey, nomark, plain;
  91.         "-",
  92.             noicon, nokey, nomark, plain;
  93.         "Quit",
  94.             noicon, "Q", nomark, plain
  95.     }
  96. };
  97.  
  98. resource 'MENU' (mEdit, preload) {
  99.     mEdit, textMenuProc,
  100.     0b0000000000000000000000000000000,    /* program does the enabling */
  101.     enabled, "Edit",
  102.      {
  103.         "Undo",
  104.             noicon, "Z", nomark, plain;
  105.         "-",
  106.             noicon, nokey, nomark, plain;
  107.         "Cut",
  108.             noicon, "X", nomark, plain;
  109.         "Copy",
  110.             noicon, "C", nomark, plain;
  111.         "Paste",
  112.             noicon, "V", nomark, plain;
  113.         "Clear",
  114.             noicon, nokey, nomark, plain
  115.     }
  116. };
  117.  
  118. resource 'MENU' (myMenu, preload) {
  119.     myMenu, textMenuProc,
  120.     0b0000000000000000000000000000000,
  121.     enabled, "Strings",
  122.     {    /* array: 5 elements */
  123.         /* [1] */
  124.         "C++", noIcon, nokey, noMark, plain,
  125.         /* [2] */
  126.         "Sample", noIcon, nokey, noMark, plain,
  127.         /* [3] */
  128.         "Application", noIcon, nokey, noMark, plain,
  129.         /* [4] */
  130.         "-", noIcon, noKey, noMark, plain,
  131.         /* [5] */
  132.         "Have Fun", noIcon, nokey, noMark, plain
  133.     }
  134. };
  135.  
  136. /* the About screen */
  137.  
  138. resource 'ALRT' (rAboutAlert, purgeable) {
  139.     {40, 20, 190, 360 }, rAboutAlert, {
  140.         OK, visible, silent;
  141.         OK, visible, silent;
  142.         OK, visible, silent;
  143.         OK, visible, silent
  144.     };
  145. };
  146.  
  147. resource 'DITL' (rAboutAlert, purgeable) {
  148.     { /* array DITLarray: 5 elements */
  149.         /* [1] */
  150.         {120, 240, 140, 320},
  151.         Button {
  152.             enabled,
  153.             "OK"
  154.         },
  155.         /* [2] */
  156.         {8, 8, 24, 320 },
  157.         StaticText {
  158.             disabled,
  159.             "MacTutorApp: C++ mini-application skeleton"
  160.         },
  161.         /* [3] */
  162.         {32, 8, 48, 320},
  163.         StaticText {
  164.             disabled,
  165.             "Copyright © 1989 J. Langowski / MacTutor"
  166.         },
  167.         /* [4] */
  168.         {56, 8, 72, 320},
  169.         StaticText {
  170.             disabled,
  171.             "[Based on examples by Apple MacDTS]"
  172.         },
  173.         /* [5] */
  174.         {80, 8, 112, 320},
  175.         StaticText {
  176.             disabled,
  177.             "Expand this application to your own taste"
  178.         }
  179.     }
  180. };
  181.  
  182.  
  183. resource 'WIND' (rDocWindow, preload, purgeable) {
  184.     {64, 60, 314, 460},
  185.     noGrowDocProc, invisible, goAway, 0x0, "MacTutor C++ demo"
  186. };
  187.  
  188.  
  189. resource 'STR#' (kMacTutorAppErrStrings, purgeable) {
  190.     {
  191.     "Not enough memory to run MacTutorApp";
  192.     "Cannot create window";
  193.     }
  194. };
  195.  
  196. resource 'SIZE' (-1) {
  197.     dontSaveScreen,
  198.     acceptSuspendResumeEvents,
  199.     enableOptionSwitch,
  200.     canBackground,
  201.     multiFinderAware,
  202.     backgroundAndForeground,
  203.     dontGetFrontClicks,
  204.     ignoreChildDiedEvents,
  205.     is32BitCompatible,
  206.     reserved, reserved, reserved, reserved,
  207.     reserved, reserved, reserved,
  208.     kPrefSize * 1024,
  209.     kMinSize * 1024
  210. };
  211.  
  212.  
  213. type 'JLMT' as 'STR ';
  214.  
  215.  
  216. resource 'JLMT' (0) {
  217.     "MacTutor C++ Sample Application"
  218. };
  219.  
  220.  
  221. resource 'BNDL' (128) {
  222.     'JLMT',
  223.     0,
  224.     {
  225.         'ICN#',
  226.         {
  227.             0, 128
  228.         },
  229.         'FREF',
  230.         {
  231.             0, 128
  232.         }
  233.     }
  234. };
  235.  
  236.  
  237. resource 'FREF' (128) {
  238.     'APPL',
  239.     0,
  240.     ""
  241. };
  242.  
  243. resource 'ICN#' (128) {
  244.     {    /* array: 2 elements */
  245.         /* [1] */
  246.         $"00 01 80 00 00 07 E0 00 00 1F F8 00 00 7F FE 00"
  247.         $"01 FF FF 80 07 FF FF E0 0F FF 0F F8 07 FF 33 FC"
  248.         $"03 FF FC 38 06 FF FF C8 0C 3F FF FE 08 0F FF D6"
  249.         $"08 03 FF 96 08 F0 FF 19 09 F8 3E 16 09 88 0C 19"
  250.         $"08 00 00 16 08 00 00 10 0B 1E 78 D0 0B FF FF D0"
  251.         $"09 FF FF 90 FC 7E 7E 3E 96 00 00 6A D3 FF FF CA"
  252.         $"52 00 00 4A 53 FF FF CB A6 38 70 69 DC 44 88 3F"
  253.         $"1F 38 73 98 38 87 04 4C 67 08 83 86 7F FF FF FE",
  254.         /* [2] */
  255.         $"00 07 E0 00 00 1F F8 00 00 7F FE 00 01 FF FF 80"
  256.         $"07 FF FF E0 1F FF FF F8 1F FF FF FC 0F FF FF FE"
  257.         $"07 FF FF FC 07 FF FF F8 0F FF FF FE 0F FF FF FE"
  258.         $"0F FF FF FE 0F FF FF FF 0F FF FF FE 0F FF FF FF"
  259.         $"0F FF FF F6 0F FF FF F0 0F FF FF F0 0F FF FF F0"
  260.         $"0F FF FF F0 FF FF FF FE F7 FF FF EE F3 FF FF CE"
  261.         $"73 FF FF CE 73 FF FF CF E7 FF FF EF DF FF FF FF"
  262.         $"1F FF FF F8 7F FF FF FE FF FF FF FF FF FF FF FF"
  263.     }
  264. };
  265.  
  266.